// 2025/3/26
// 扑克牌顺子

class Solution {
    public:
        /**
         * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
         *
         * 
         * @param numbers int整型vector 
         * @return bool布尔型
         */
        bool IsContinuous(vector<int>& numbers) {
            // write code here
            sort(numbers.begin(), numbers.end());
            int count = 0, n = numbers.size();
            for (int i = 0; i < n - 1; i++)
            {
                if (numbers[i] == 0)
                    count++;
                else if (numbers[i] == numbers[i + 1])
                    return false;
                else
                {
                    count -= numbers[i + 1] - numbers[i] - 1;
                    if (count < 0)
                        return false;
                }
            }
            return true;
        }
    };